import axios from 'axios'
import qs from 'qs'
const weGameServer = axios.create({
    baseURL: 'https://www.wegame.com.cn'
})
weGameServer.defaults.withCredentials = true;
//拦截器暂时用不到





//编译id
const qsFrom = (id) => {
    return qs.stringify({ p: JSON.stringify({ 'pos_id': id, 'channel_id': '0' }) })
}




//读取轮播图接口
export const getSwiperList = () => {
    return weGameServer.post('/api/v1/wegame.rail.game.PromptMarket/QueryPromptMarket/',
        { "from_src": "front", "channel_id": 0, "pos_id_list": [9000] })
        .then(res => res.data)
}
//读取游戏列表
export const getGameList = () => {
    return weGameServer.post('/api/forum/lua/wg_gg/query_material',
        qsFrom(10000)
    )
        .then(res => res.data)
}
//游戏专区列表
export const getGameArea = () => {
    return weGameServer.post('/api/rail/web/data_filter/game_config/query',
        { "data_names": "special_zone_entry", "command": "list_all", "params": { "start_page": 0, "items_per_pager": 50, "filters": [] }, "stamp": { "agent_client_language": "" }, "response_format": 0 })
        .then(res => res.data)
}
//读取排行榜数据

export const getRankList = () => {
    return weGameServer.post('/api/rail/web/data_filter/game_info/filter',
        { "property": [], "rank_name": "best_seller", "sort_by_asc": false, "filters": ["game_id", "e_game_name", "game_name", "name", "game_type", "category", "comments", "screenshots", "banner_icon_url", "logo_url", "poster_url_h", "poster_url_v", "poster_h_decorative", "3rd_class", "4th_class", "top_class", "sub_class", "tags", "show_prate", "is_testing", "testing_state", "is_big_version", "is_wing_project", "release_config", "master_game_id", "timeline", "release_time", "release_time_unsure", "publish_time", "disable_independent_sale", "latest_purchase_rank", "last_purchase_rank", "week_recommend_ratio", "month_recommend_ratio", "total_recommend_ratio", "sub_game_type", "prop_mobile", "poster_h_color"], "keyword": "", "search_field": [], "tags": [], "stamp": { "agent_client_language": "zh_CN" }, "response_format": 0, "start_page": 0, "items_per_pager": 10, "search_type": 0, "list_type": 7, "only_open_sell": true, "need_hot_rank_compare": true, "need_gray_game": false })
        .then(res => res.data)
}